/**
 * @file    queue_event.h
 * @brief   队列管理
 * @author  Liuwei
 * @version 1.0.1
 * @date    2023-04-18
 * 
 * @copyright Copyright (c) 2023 JBD-Energy Storage Technology Co. LTD
 * 
 * @par 修改日志:
 * <table>
 * <tr><th>Date       <th>Version   <th>Author   <th>Description
 * <tr><td>2023-04-18 <td>1.0.1     <td>队列     <td>首次创建
 * </table>
 */
#ifndef __QUEUE_EVENT_H_
#define __QUEUE_EVENT_H_

/* File Includes -------------------------------------------------------------*/
#include <stdint.h>
#include "event_mng.h"
/* Cplusplus -----------------------------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#endif

/* Macro/Define/Typedef ------------------------------------------------------*/
typedef struct queue
{
   uint16_t head;      /*!< 队列头*/
   uint16_t tail;      /*!< 队列尾*/
   uint16_t free_size; /*!< 可用空间*/
   uint16_t cap_size;  /*!< 最大空间*/

   event_data_type *data_buf;  /*!< 数据缓冲区域 */
}queue_type;
/* @brief */

/* Variables -----------------------------------------------------------------*/

/*******************************************************************************
 * public API List
 ******************************************************************************/
void queue_init(queue_type *queue , uint16_t size , event_data_type *buff);
uint8_t queue_is_empty(const queue_type queue);
uint8_t queue_is_full(const queue_type queue);
void queue_in_fifo(queue_type *queue ,const event_data_type event_data);
uint8_t queue_out_fifo(queue_type *queue , event_data_type *buff);

/*! @} End of Interface API List */

#ifdef __cplusplus
}
#endif

#endif  /* #ifndef __QUEUE_EVENT_H_ */
/********** Copyright (c) 2023 JBD-Energy Storage Technology Co. LTD *********/



